﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FonShare.Classes.Data
{
    /// <summary>
    /// Manager to the Database to get Data.
    /// </summary>
    /// <author>spesme</author>
    /// <since>26/06/2009</since>
    public static class FS_DataManager
    {
        /// <summary>
        /// Gets the user servers.
        /// </summary>
        /// <param name="p_userId">The user id.</param>
        /// <returns>A List of servers of the specified user.</returns>
        /// <author>spesme</author>
        /// <since>26/06/2009</since>
        public static FS_Server GetUserServer(int p_userId)
        {
            FS_Server result = null;
            FS_DataClassesDataContext dc = new FS_DataClassesDataContext();
            List<FS_Server> serversList = dc.FS_Servers.Where(record => record.OwnerID == p_userId).ToList();
            if (serversList.Count == 1)
            {
                result = serversList.First();
            }
            return result;
        }
    }
}
